<template>
  <div class="header">
    <div class="header-top">
      <div class="header-user">
        尚品汇欢迎您！请 <router-link to="/login">登录</router-link> |
        <router-link to="/register">免费注册</router-link>
      </div>
      <ul class="header-nav">
        <li>我的订单</li>
        <li>我的购物车</li>
        <li>我的尚品汇</li>
        <li>尚品汇会员</li>
        <li>企业采购</li>
        <li>关注尚品汇</li>
        <li>合作招商</li>
        <li class="header-nav-last">商家后台</li>
      </ul>
    </div>
    <div class="header-bottom">
      <router-link to="/">
        <img class="header-logo" src="./images/logo.png" alt="logo" />
      </router-link>
      <!-- 
        点击按钮会提交表单，禁止提交表单的默认行为
       -->
      <form class="header-search" @submit.prevent="toSearch">
        <input type="text" />
        <!-- <button @click.prevent="toSearch">搜索</button> -->
        <button>搜索</button>
      </form>
    </div>
  </div>
</template>

<script>
export default {
  name: "Header",
};
</script>

<style lang="less" scoped>
.header-top {
  padding: 10px 20px;
  background-color: #eaeaea;
  display: flex;
  justify-content: space-between;
}
// 嵌套样式一般最多2-3层
.header-nav {
  display: flex;
  li {
    margin-left: 10px;
    padding-right: 10px;
    border-right: 1px solid #000;
  }
  .header-nav-last {
    border-right: none;
    padding-right: 0;
  }
}

.header-bottom {
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-search {
  display: flex;
  align-items: center;
  input {
    box-sizing: border-box;
    border: 1px solid red;
    padding-left: 10px;
    outline: none;
    width: 500px;
    height: 30px;
    font-size: 18px;
  }
  button {
    width: 80px;
    height: 30px;
    background-color: red;
    color: #fff;
    border: none;
  }
}
</style>